home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 May / PCPlus May 1998=disk A.iso / full / CBUILDER / SAMS / SAMPLES / CHAP04 / AIRPLANE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-12  |  1.0 KB  |  55 lines

  1. //---------------------------------------------------------------------------
  2. #ifndef airplaneH
  3. #define airplaneH
  4.  
  5. #define AIRLINER        0
  6. #define    COMMUTER        1
  7. #define    PRIVATE            2
  8. #define    TAKINGOFF        0
  9. #define    CRUISING        1
  10. #define LANDING            2
  11. #define ONRAMP            3
  12. #define    MSG_CHANGE    0
  13. #define    MSG_TAKEOFF    1
  14. #define    MSG_LAND        2
  15. #define    MSG_REPORT    3
  16.  
  17. class Airplane {
  18.     public:
  19.         Airplane(const char* _name, int _type = AIRLINER);
  20.       ~Airplane();
  21.         virtual int GetStatus(char* statusString);
  22.         int GetStatus()
  23.       {
  24.     return status;
  25.     }
  26.        int Speed()
  27.       {
  28.         return speed;
  29.       }
  30.         int Heading()
  31.     {
  32.         return heading;
  33.     }
  34.     int Altitude()
  35.     {
  36.         return altitude;
  37.     }
  38.     void ReportStatus();
  39.     bool SendMessage(int msg, char* response,
  40.         int spd = -1, int dir = -1, int alt = -1);
  41.     char* name;
  42.     protected:
  43.       virtual void TakeOff(int dir);
  44.     virtual void Land();
  45.   private:
  46.         int speed;
  47.     int altitude;
  48.     int heading;
  49.     int status;
  50.     int type;
  51.     int ceiling;
  52. };
  53.  
  54. #endif
  55.